package spendreport;

import org.apache.flink.streaming.api.functions.KeyedProcessFunction;
import org.apache.flink.util.Collector;

import spendreport.pojo.AccountTransation;

public class FraudDetector extends KeyedProcessFunction<String, AccountTransation, AccountTransation> {

	private static final long serialVersionUID = 1L;

	private static final double SMALL_AMOUNT = 1.00;
	private static final double LARGE_AMOUNT = 500.00;
	private static final long ONE_MINUTE = 60 * 1000;

	@Override
	public void processElement(
			AccountTransation transaction,
			Context context,
			Collector<AccountTransation> collector) throws Exception {

		// 不停的收集数据,即存在诈骗的交易账户
		if(transaction.getTransationMoney()>LARGE_AMOUNT) {
			collector.collect(transaction);
		}
		
	}
}